const axios = require('axios');

// 测试API接口
async function testAPI() {
    try {
        const response = await axios.get('http://localhost:8000/jinx/rechargeOrder/userDisplayBalanceIneStatistics', {
            params: {
                startMonth: '2021-01',
                endMonth: '2023-03'
            },
            headers: {
                'Content-Type': 'application/json'
            }
        });
        
        console.log('API响应状态:', response.status);
        console.log('API响应数据:', JSON.stringify(response.data, null, 2));
        
        if (response.data.code === 200) {
            console.log('✅ API调用成功！');
            console.log('余额:', response.data.userDisplayBalanceIneStatistics.balance);
            console.log('当月收入:', response.data.userDisplayBalanceIneStatistics.monthly_income);
            console.log('当月提现:', response.data.userDisplayBalanceIneStatistics.monthly_expenditure);
            console.log('数据条数:', response.data.userDisplayBalanceIneStatistics.list_income_withdrawal_statistics.length);
        } else {
            console.log('❌ API返回错误:', response.data.msg);
        }
    } catch (error) {
        console.error('❌ API调用失败:', error.message);
        if (error.response) {
            console.error('错误状态码:', error.response.status);
            console.error('错误数据:', error.response.data);
        }
    }
}

// 运行测试
console.log('开始测试API接口...');
testAPI(); 